<?php

	//process an uploaded file
	include('includes/header.php');
?>
<h1>File Uploaded</h1>

<?php
$target_path = dirname(__FILE__)."/media/uploads/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
    " has been uploaded. Please wait several minutes for it to be processed.";

    //add the file to the database
    video_insert($_FILES['uploadedfile']['name']);
} else{
    echo "There was an error uploading the file, to $target_path: please try again!";
    print_r($_FILES);
}

?>
